uCOS Start Functions

OSInit

OSInit()
  • Creates the idle task and sets its priority to OS_LOWEST_PRIO.
  • Optionally creates the statistic task and sets its priority to OS_LOWEST_PRIO-1.
  • The idle and stat tasks are added to the TCB list.
  • Creates the Free Pools
    • TCB Free List - OS_MAX_TASKS TCBs are added
    • Event Free List - OS_MAX_EVENTS events are added
    • Queue Free List - OS_MAX_QS queues are added
    • Flag Free List - OS_MAX_FLAGS flags are added
    • Mem Free List - OS_MAX_MEM_PART memory partions are added

OSStart

OSStart()
  • At least one task must be create before calling OSStart()
  • Set the High Ready to the highest ready task
    • OSPrioCur, OSPrioHighRdy - highest priority
    • OSTCBCur, OSTCBHighRdy - TCB of current task
  • Runs highest task by calling OSStartHighRdy()
  • Never returns
  • Set OSRunning to TRUE

Example Main

void Main(void)
{
        InitHardware();
        OSInit();
        OSTaskCreat();
        OSStart();
}

void TaskOne()
{
        Timer_Init();
        // do stuff
}

Table Of Contents

Previous topic

Startup Assembly File

Next topic

Tasks

This Page